﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;

namespace DAO
{
    public class PhanNhomDAO
    {
        ConnectDB conn = new ConnectDB();
        string str;
        //Load dữ liệu
        public DataTable LoadPhanNhom()
        {
            return conn.LayDuLieu("select *from PhanNhom");
        }
        //them
        public void them(PhanNhomDTO p)
        {
            string MaHD = p.MaNV ;
            string MaSP = p.MaNhom;
            str = "INSERT PhanNhom (MaNV,MaNhomNguoiDung) VALUES('" +MaHD +"','"+MaSP +"')";
            conn.excute(str);
        }
        //xoa
        public void Del_HoaDon(PhanNhomDTO p)
        {
            string MaHD = p.MaNV ;
            str = "DELETE PhanNhom WHERE MaHD='" + MaHD + "'";
            conn.excute(str);
        }
        //
        public DataTable NV()
        {
            return conn.LayDuLieu("Select MaNV from NhanVien");
        }
        //
        public DataTable ND()
        {
            return conn.LayDuLieu("select MaNhomNguoiDung from NhomNguoiDung");
        }
    }
}
